package com.neu.service;

import com.neu.dao.DeptDao;
import com.neu.pojo.Dept;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;

@Service
@Transactional
public class DeptServiceImpl implements DeptService {
    @Autowired
    private DeptDao deptDao;
    @Override
    public List<Dept> getDeptList() {
        return deptDao.getDeptList();
    }

    @Override
    public int addDept(Dept d) {
        return deptDao.addDept(d);
    }

    @Override
    public int delDept(int id) {
        return deptDao.delDept(id);
    }

    @Override
    public int updateDept(Dept dept) {
        return deptDao.updateDept(dept);
    }

    /**
     * 分页获取部门信息
     * @param page  第几页
     * @param limit 每页显示的条数
     * @return
     */
    @Override
    public List<Dept> getDeptByPage(int page, int limit) {
        return deptDao.getDeptByPage((page-1)*limit,limit);
    }

    @Override
    public int getDeptCount() {
        return deptDao.getDeptCount();
    }
}
